//
//  MeterViewController.h
//  Teximeter
//
//  Created by BEA DONG HWAN on 11. 2. 5..
//  Copyright 2011 Ajou University. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import "NumberLineView.h"
#import <QuartzCore/QuartzCore.h>

@class SharedDBManager;

@interface MeterViewController : UIViewController<CLLocationManagerDelegate> {
	CLLocationManager *locationManager;
	
	
	IBOutlet UILabel* velocityLabel;
	IBOutlet UILabel* currentWay;
	IBOutlet UILabel* currentLati;
	IBOutlet UILabel* currentLongi;
	IBOutlet UILabel* timeLabel;
	
	NumberLineView* numberLine;
	
	
	
	
	
	
	NSTimer* timer;
	
	double beforeLati;
	double beforeLogi;
	double tempDistance;
	
	double disLati;
	double disLong;
	double speed;
	
	IBOutlet UILabel* totalDistanceLabel;
	IBOutlet UILabel* costDistanceLabel;
	IBOutlet UILabel* totalTimeLabel;
	IBOutlet UILabel* costTimeLabel;
	IBOutlet UILabel* totalCostLabel;
	
	double totalCost;
	double totalDistance;
	double costDistance;
	
	double totalTime;
	double costTime;
	
	NSDate* timeStamp;
	
	BOOL isOverBasic;
	
	IBOutlet UIButton* startButton;
	IBOutlet UIButton* endButton;
	IBOutlet UIButton* trackButton;
	IBOutlet UIButton* inforButton;
	IBOutlet UIButton* nightButton;
	
	
	BOOL isMidinght;
	BOOL isStarted;
	
	
	double baseCost;
	double beforeTimeSec;
	double delaySec;

	
	IBOutlet UIImageView* runningImage;
	IBOutlet UIImageView* nightImage;
	
	
	IBOutlet UIView* moreView;
	
	IBOutlet UITextView* debugView;
	
	int initCount;
	
	
	NSDate* oldTime;
	
	SharedDBManager* sharedDB;
	NSMutableArray* oldTimeArray;
	
	NSMutableArray* costTimeArray;
	
	double basicTimeCheck;
	
	double invalidCount;
	double valideCount;
	double trustGPS;
	
	IBOutlet UIView* cover;
	
	
	IBOutlet UILabel* validCountLabel;
	
	IBOutlet UILabel* loadingPercent;
	
	BOOL signalChecked;
}

-(IBAction)clickTemp;
-(IBAction)clickStart;
-(IBAction)clickEnd;
-(IBAction)showTrack;
-(IBAction)clickInfor;
-(IBAction)clickNight;
-(IBAction)clickMore;

-(void)getDistance;
-(void)checkMidnight;
-(void)initData;
@end
